//组件注册
import Vue from "vue"

//@ is alias to src @表示指向src 

//全局注册组件
Vue.filter("rolename", (value) => {
    if (!value) return value

    switch (value) {
        case "1":
            return "普通居民"
            break;
        case "2":
            return "安保人员"
            break;
        case "3":
            return "控疫专员"
            break;
        case "4":
            return "社区主任"
            break;
        default:
            return ""
            break
    }
})

Vue.filter("colortype", (value) => {
    if (!value) return value

    switch (value) {
        case "1":
            return "success"
            break;
        case "2":
            return "warning"
            break;
        case "3":
            return "primary"
            break;
        case "4":
            return "danger"
            break;
        default:
            return ""
            break
    }
})

import moment from "moment"
Vue.filter("timeFormat",(value,format)=>{
    if(!value)  return value
    format = format ||"YYYY-MM-DD HH:mm:ss"
    return moment(value).format(format)
})